using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity.ModelConfiguration;

namespace ConsoleApplication2.Models.Mapping
{
    public class vBalanceSheetMap : EntityTypeConfiguration<vBalanceSheet>
    {
        public vBalanceSheetMap()
        {
            // Primary Key
            this.HasKey(t => new { t.Acct, t.AcctDescrip });

            // Properties
            this.Property(t => t.Acct)
                .IsRequired()
                .HasMaxLength(40);

            this.Property(t => t.AcctDescrip)
                .IsRequired()
                .HasMaxLength(50);

            this.Property(t => t.Type)
                .HasMaxLength(11);

            this.Property(t => t.Class)
                .HasMaxLength(10);

            this.Property(t => t.SubType)
                .HasMaxLength(31);

            this.Property(t => t.Header)
                .HasMaxLength(75);

            // Table & Column Mappings
            this.ToTable("vBalanceSheet");
            this.Property(t => t.Acct).HasColumnName("Acct");
            this.Property(t => t.AcctDescrip).HasColumnName("AcctDescrip");
            this.Property(t => t.Type).HasColumnName("Type");
            this.Property(t => t.Class).HasColumnName("Class");
            this.Property(t => t.SubType).HasColumnName("SubType");
            this.Property(t => t.Header).HasColumnName("Header");
            this.Property(t => t.Begdrdol).HasColumnName("Begdrdol");
            this.Property(t => t.Begcrdol).HasColumnName("Begcrdol");
            this.Property(t => t.Begdr).HasColumnName("Begdr");
            this.Property(t => t.Begcr).HasColumnName("Begcr");
        }
    }
}
